home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / usr / lib / mozilla-firefox / include / necko / nsIAuthModule.h < prev    next >
C/C++ Source or Header  |  2006-05-08  |  10KB  |  227 lines

  1. /*
  2.  * DO NOT EDIT.  THIS FILE IS GENERATED FROM nsIAuthModule.idl
  3.  */
  4.  
  5. #ifndef __gen_nsIAuthModule_h__
  6. #define __gen_nsIAuthModule_h__
  7.  
  8.  
  9. #ifndef __gen_nsISupports_h__
  10. #include "nsISupports.h"
  11. #endif
  12.  
  13. /* For IDL files that don't want to include root IDL files. */
  14. #ifndef NS_NO_VTABLE
  15. #define NS_NO_VTABLE
  16. #endif
  17.  
  18. /* starting interface:    nsIAuthModule */
  19. #define NS_IAUTHMODULE_IID_STR "6e35dbc0-49ef-4e2c-b1ea-b72ec64450a2"
  20.  
  21. #define NS_IAUTHMODULE_IID \
  22.   {0x6e35dbc0, 0x49ef, 0x4e2c, \
  23.     { 0xb1, 0xea, 0xb7, 0x2e, 0xc6, 0x44, 0x50, 0xa2 }}
  24.  
  25. class NS_NO_VTABLE nsIAuthModule : public nsISupports {
  26.  public: 
  27.  
  28.   NS_DEFINE_STATIC_IID_ACCESSOR(NS_IAUTHMODULE_IID)
  29.  
  30.   /**
  31.      * Default behavior.
  32.      */
  33.   enum { REQ_DEFAULT = 0U };
  34.  
  35.   /**
  36.      * Client and server will be authenticated.
  37.      */
  38.   enum { REQ_MUTUAL_AUTH = 1U };
  39.  
  40.   /**
  41.      * The server is allowed to impersonate the client.  The REQ_MUTUAL_AUTH
  42.      * flag may also need to be specified in order for this flag to take
  43.      * effect.
  44.      */
  45.   enum { REQ_DELEGATE = 2U };
  46.  
  47.   /** Other flags may be defined in the future */
  48. /**
  49.      * Called to initialize an auth module.  The other methods cannot be called
  50.      * unless this method succeeds.
  51.      *
  52.      * @param aServiceName
  53.      *        the service name, which may be null if not applicable (e.g., for
  54.      *        NTLM, this parameter should be null).
  55.      * @param aServiceFlags
  56.      *        a bitwise-or of the REQ_ flags defined above (pass REQ_DEFAULT
  57.      *        for default behavior).
  58.      * @param aDomain
  59.      *        the authentication domain, which may be null if not applicable.
  60.      * @param aUsername
  61.      *        the user's login name
  62.      * @param aPassword
  63.      *        the user's password
  64.      */
  65.   /* void init (in string aServiceName, in unsigned long aServiceFlags, in wstring aDomain, in wstring aUsername, in wstring aPassword); */
  66.   NS_IMETHOD Init(const char *aServiceName, PRUint32 aServiceFlags, const PRUnichar *aDomain, const PRUnichar *aUsername, const PRUnichar *aPassword) = 0;
  67.  
  68.   /**
  69.      * Called to get the next token in a sequence of authentication steps.
  70.      *
  71.      * @param aInToken
  72.      *        A buffer containing the input token (e.g., a challenge from a
  73.      *        server).  This may be null.
  74.      * @param aInTokenLength
  75.      *        The length of the input token.
  76.      * @param aOutToken
  77.      *        If getNextToken succeeds, then aOutToken will point to a buffer
  78.      *        to be sent in response to the server challenge.  The length of
  79.      *        this buffer is given by aOutTokenLength.  The buffer at aOutToken
  80.      *        must be recycled with a call to nsMemory::Free.
  81.      * @param aOutTokenLength
  82.      *        If getNextToken succeeds, then aOutTokenLength contains the
  83.      *        length of the buffer (number of bytes) pointed to by aOutToken.
  84.      */
  85.   /* void getNextToken ([const] in voidPtr aInToken, in unsigned long aInTokenLength, out voidPtr aOutToken, out unsigned long aOutTokenLength); */
  86.   NS_IMETHOD GetNextToken(const void * aInToken, PRUint32 aInTokenLength, void * *aOutToken, PRUint32 *aOutTokenLength) = 0;
  87.  
  88.   /** 
  89.      * Once a security context has been established through calls to GetNextToken()
  90.      * it may be used to protect data exchanged between client and server. Calls
  91.      * to Wrap() are used to protect items of data to be sent to the server.
  92.      * 
  93.      * @param aInToken
  94.      *        A buffer containing the data to be sent to the server
  95.      * @param aInTokenLength
  96.      *        The length of the input token
  97.      * @param confidential
  98.      *        If set to true, Wrap() will encrypt the data, otherwise data will
  99.      *        just be integrity protected (checksummed)
  100.      * @param aOutToken
  101.      *        A buffer containing the resulting data to be sent to the server
  102.      * @param aOutTokenLength
  103.      *        The length of the output token buffer
  104.      *
  105.      * Wrap() may return NS_ERROR_NOT_IMPLEMENTED, if the underlying authentication
  106.      * mechanism does not support security layers.
  107.      */
  108.   /* void wrap ([const] in voidPtr aInToken, in unsigned long aInTokenLength, in boolean confidential, out voidPtr aOutToken, out unsigned long aOutTokenLength); */
  109.   NS_IMETHOD Wrap(const void * aInToken, PRUint32 aInTokenLength, PRBool confidential, void * *aOutToken, PRUint32 *aOutTokenLength) = 0;
  110.  
  111.   /** 
  112.      * Unwrap() is used to unpack, decrypt, and verify the checksums on data
  113.      * returned by a server when security layers are in use.
  114.      * 
  115.      * @param aInToken
  116.      *        A buffer containing the data received from the server
  117.      * @param aInTokenLength
  118.      *        The length of the input token
  119.      * @param aOutToken
  120.      *        A buffer containing the plaintext data from the server
  121.      * @param aOutTokenLength
  122.      *        The length of the output token buffer
  123.      *
  124.      * Unwrap() may return NS_ERROR_NOT_IMPLEMENTED, if the underlying  
  125.      * authentication mechanism does not support security layers.
  126.      */
  127.   /* void unwrap ([const] in voidPtr aInToken, in unsigned long aInTokenLength, out voidPtr aOutToken, out unsigned long aOutTokenLength); */
  128.   NS_IMETHOD Unwrap(const void * aInToken, PRUint32 aInTokenLength, void * *aOutToken, PRUint32 *aOutTokenLength) = 0;
  129.  
  130. };
  131.  
  132. /* Use this macro when declaring classes that implement this interface. */
  133. #define NS_DECL_NSIAUTHMODULE \
  134.   NS_IMETHOD Init(const char *aServiceName, PRUint32 aServiceFlags, const PRUnichar *aDomain, const PRUnichar *aUsername, const PRUnichar *aPassword); \
  135.   NS_IMETHOD GetNextToken(const void * aInToken, PRUint32 aInTokenLength, void * *aOutToken, PRUint32 *aOutTokenLength); \
  136.   NS_IMETHOD Wrap(const void * aInToken, PRUint32 aInTokenLength, PRBool confidential, void * *aOutToken, PRUint32 *aOutTokenLength); \
  137.   NS_IMETHOD Unwrap(const void * aInToken, PRUint32 aInTokenLength, void * *aOutToken, PRUint32 *aOutTokenLength); 
  138.  
  139. /* Use this macro to declare functions that forward the behavior of this interface to another object. */
  140. #define NS_FORWARD_NSIAUTHMODULE(_to) \
  141.   NS_IMETHOD Init(const char *aServiceName, PRUint32 aServiceFlags, const PRUnichar *aDomain, const PRUnichar *aUsername, const PRUnichar *aPassword) { return _to Init(aServiceName, aServiceFlags, aDomain, aUsername, aPassword); } \
  142.   NS_IMETHOD GetNextToken(const void * aInToken, PRUint32 aInTokenLength, void * *aOutToken, PRUint32 *aOutTokenLength) { return _to GetNextToken(aInToken, aInTokenLength, aOutToken, aOutTokenLength); } \
  143.   NS_IMETHOD Wrap(const void * aInToken, PRUint32 aInTokenLength, PRBool confidential, void * *aOutToken, PRUint32 *aOutTokenLength) { return _to Wrap(aInToken, aInTokenLength, confidential, aOutToken, aOutTokenLength); } \
  144.   NS_IMETHOD Unwrap(const void * aInToken, PRUint32 aInTokenLength, void * *aOutToken, PRUint32 *aOutTokenLength) { return _to Unwrap(aInToken, aInTokenLength, aOutToken, aOutTokenLength); } 
  145.  
  146. /* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
  147. #define NS_FORWARD_SAFE_NSIAUTHMODULE(_to) \
  148.   NS_IMETHOD Init(const char *aServiceName, PRUint32 aServiceFlags, const PRUnichar *aDomain, const PRUnichar *aUsername, const PRUnichar *aPassword) { return !_to ? NS_ERROR_NULL_POINTER : _to->Init(aServiceName, aServiceFlags, aDomain, aUsername, aPassword); } \
  149.   NS_IMETHOD GetNextToken(const void * aInToken, PRUint32 aInTokenLength, void * *aOutToken, PRUint32 *aOutTokenLength) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetNextToken(aInToken, aInTokenLength, aOutToken, aOutTokenLength); } \
  150.   NS_IMETHOD Wrap(const void * aInToken, PRUint32 aInTokenLength, PRBool confidential, void * *aOutToken, PRUint32 *aOutTokenLength) { return !_to ? NS_ERROR_NULL_POINTER : _to->Wrap(aInToken, aInTokenLength, confidential, aOutToken, aOutTokenLength); } \
  151.   NS_IMETHOD Unwrap(const void * aInToken, PRUint32 aInTokenLength, void * *aOutToken, PRUint32 *aOutTokenLength) { return !_to ? NS_ERROR_NULL_POINTER : _to->Unwrap(aInToken, aInTokenLength, aOutToken, aOutTokenLength); } 
  152.  
  153. #if 0
  154. /* Use the code below as a template for the implementation class for this interface. */
  155.  
  156. /* Header file */
  157. class nsAuthModule : public nsIAuthModule
  158. {
  159. public:
  160.   NS_DECL_ISUPPORTS
  161.   NS_DECL_NSIAUTHMODULE
  162.  
  163.   nsAuthModule();
  164.  
  165. private:
  166.   ~nsAuthModule();
  167.  
  168. protected:
  169.   /* additional members */
  170. };
  171.  
  172. /* Implementation file */
  173. NS_IMPL_ISUPPORTS1(nsAuthModule, nsIAuthModule)
  174.  
  175. nsAuthModule::nsAuthModule()
  176. {
  177.   /* member initializers and constructor code */
  178. }
  179.  
  180. nsAuthModule::~nsAuthModule()
  181. {
  182.   /* destructor code */
  183. }
  184.  
  185. /* void init (in string aServiceName, in unsigned long aServiceFlags, in wstring aDomain, in wstring aUsername, in wstring aPassword); */
  186. NS_IMETHODIMP nsAuthModule::Init(const char *aServiceName, PRUint32 aServiceFlags, const PRUnichar *aDomain, const PRUnichar *aUsername, const PRUnichar *aPassword)
  187. {
  188.     return NS_ERROR_NOT_IMPLEMENTED;
  189. }
  190.  
  191. /* void getNextToken ([const] in voidPtr aInToken, in unsigned long aInTokenLength, out voidPtr aOutToken, out unsigned long aOutTokenLength); */
  192. NS_IMETHODIMP nsAuthModule::GetNextToken(const void * aInToken, PRUint32 aInTokenLength, void * *aOutToken, PRUint32 *aOutTokenLength)
  193. {
  194.     return NS_ERROR_NOT_IMPLEMENTED;
  195. }
  196.  
  197. /* void wrap ([const] in voidPtr aInToken, in unsigned long aInTokenLength, in boolean confidential, out voidPtr aOutToken, out unsigned long aOutTokenLength); */
  198. NS_IMETHODIMP nsAuthModule::Wrap(const void * aInToken, PRUint32 aInTokenLength, PRBool confidential, void * *aOutToken, PRUint32 *aOutTokenLength)
  199. {
  200.     return NS_ERROR_NOT_IMPLEMENTED;
  201. }
  202.  
  203. /* void unwrap ([const] in voidPtr aInToken, in unsigned long aInTokenLength, out voidPtr aOutToken, out unsigned long aOutTokenLength); */
  204. NS_IMETHODIMP nsAuthModule::Unwrap(const void * aInToken, PRUint32 aInTokenLength, void * *aOutToken, PRUint32 *aOutTokenLength)
  205. {
  206.     return NS_ERROR_NOT_IMPLEMENTED;
  207. }
  208.  
  209. /* End of implementation class template. */
  210. #endif
  211.  
  212. /**
  213.  * nsIAuthModule implementations are registered under the following contract
  214.  * ID prefix:
  215.  */
  216. #define NS_AUTH_MODULE_CONTRACTID_PREFIX \
  217.     "@mozilla.org/network/auth-module;1?name="
  218. /**
  219.  * This success code may be returned by nsIAuthModule::getNextToken to 
  220.  * indicate that the authentication is finished and thus there's no need 
  221.  * to call getNextToken again.
  222.  */
  223. #define NS_SUCCESS_AUTH_FINISHED \
  224.     NS_ERROR_GENERATE_SUCCESS(NS_ERROR_MODULE_NETWORK, 40)
  225.  
  226. #endif /* __gen_nsIAuthModule_h__ */
  227.